<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Make Controller Kit - Firmware API: XBee - OSC</title>
<link href="mt_doxygen.css" rel="stylesheet" type="text/css" />
<link href="../resources/mt_doxytabs.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.header {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12pt;
	color: #222222;
}
-->
</style>
</head>

<body>
<table width="800" border="0">
    <tr>
      <td colspan="3">
        <form method="get" action="http://www.google.com/search">
          <div align="right">
            <input type="text"   name="q" size="25"
              maxlength="255" value="" />
            <input type="submit" value="Search" />
            <input type="hidden" name="sitesearch" value="makingthings.com/ref/firmware/html" />
          </div>
        </form>
       </td>
    </tr>
    <tr>
      <td><div align="center"><a href="http://www.makingthings.com">
				<img src="../resources/logo_brown_medium.png" alt="MakingThings"
									width="200" height="78" border="0" align="middle" longdesc="http://www.makingthings.com" /></a></div></td>
				<td><div align="center" class="header">
      		Make Controller Kit <br />
          Firmware API
      </div></td>
      <td><div align="center"><a href="http://www.makezine.com">
					<img src="../resources/make_logo.png" alt="MAKE Zine" 
										width="164" height="73" border="0" align="middle" longdesc="http://www.makezine.com" /></a></div></td>
    </tr>
</table>
</body>
</html>
<!-- Generated by Doxygen 1.5.4 -->
<script type="text/javascript">
<!--
function changeDisplayState (e){
  var num=this.id.replace(/[^[0-9]/g,'');
  var button=this.firstChild;
  var sectionDiv=document.getElementById('dynsection'+num);
  if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
    sectionDiv.style.display='block';
    button.src='open.gif';
  }else{
    sectionDiv.style.display='none';
    button.src='closed.gif';
  }
}
function initDynSections(){
  var divs=document.getElementsByTagName('div');
  var sectionCounter=1;
  for(var i=0;i<divs.length-1;i++){
    if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
      var header=divs[i];
      var section=divs[i+1];
      var button=header.firstChild;
      if (button!='IMG'){
        divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
        button=document.createElement('img');
        divs[i].insertBefore(button,divs[i].firstChild);
      }
      header.style.cursor='pointer';
      header.onclick=changeDisplayState;
      header.id='dynheader'+sectionCounter;
      button.src='closed.gif';
      section.id='dynsection'+sectionCounter;
      section.style.display='none';
      section.style.marginLeft='14px';
      sectionCounter++;
    }
  }
}
window.onload = initDynSections;
-->
</script>
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="classes.html"><span>Data&nbsp;Structures</span></a></li>
    <li><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul>
</div>
<h1>XBee - OSC<br>
<small>
[<a class="el" href="group___o_s_c.html">OSC</a>]</small>
</h1>Communicate with XBee modules with the Make Controller Kit via OSC.  
<a href="#_details">More...</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
</table>
<h2><a class="anchor" name="devices">
Devices</a></h2>
There can only be one XBee board connected to the Make Controller Kit's serial port at a time, so there is not a device index in XBee OSC messages.<h2><a class="anchor" name="properties">
Properties</a></h2>
The XBee system has the following properties:<ul>
<li>autosend</li><li>io16</li><li>io64</li><li>rx16</li><li>rx64</li><li>tx16</li><li>tx64</li><li>tx-status</li><li>active</li></ul>
<p>
<dl class="user" compact><dt><b>Autosend</b></dt><dd>The <b>autosend</b> property corresponds to whether the Make Controller will automatically send out messages it receives from a connected XBee module. By default, this is turned off. To turn this on, send the message <div class="fragment"><pre class="fragment">/xbee/autosend 1 </pre></div> and to turn it off, send <div class="fragment"><pre class="fragment">/xbee/autosend 0 </pre></div> All autosend messages send at the same interval. You can set this interval, in milliseconds, by sending the message <div class="fragment"><pre class="fragment">/system/autosend-interval 10 </pre></div> so that messages will be sent every 10 milliseconds. This can be anywhere from 1 to 5000 milliseconds. </dd></dl>
<dl class="user" compact><dt><b></b></dt><dd>You also need to select whether the board should send to you over USB or Ethernet. Send <div class="fragment"><pre class="fragment">/system/autosend-usb 1 </pre></div> to send via USB, and <div class="fragment"><pre class="fragment">/system/autosend-udp 1 </pre></div> to send via Ethernet. Via Ethernet, the board will send messages to the last address it received a message from.</dd></dl>
<dl class="user" compact><dt><b>io16</b></dt><dd>The <b>io16</b> property corresponds to an incoming message from an XBee module with samples from its IO pins. The best way to use this is to turn the XBee system's autosend property on - then the Make Controller can relay io16 messages as soon as they're received. </dd></dl>
<dl class="user" compact><dt><b></b></dt><dd>Once you've turned on autosend, if there are boards on your network that are sending IO packets, you'll receive messages like <div class="fragment"><pre class="fragment">/xbee/io16 1234 28 12 0 0 1023 1023 0 512 0 1023 </pre></div> The first two numbers are:<ol type=1>
<li>the address of the module that sent the message (1234 in the example above)</li><li>signal strength (28 above) </li></ol>
</dd></dl>
<dl class="user" compact><dt><b></b></dt><dd>The next 9 numbers are the values from the 9 IO pins on the XBee module.</dd></dl>
<dl class="user" compact><dt><b>io64</b></dt><dd>The <b>io64</b> property corresponds to an incoming message from an XBee module with samples from its IO pins. This message is just like the <b>io16</b> message, except it's coming from a board with a 64-bit address, rather than a 16-bit address. The structure of the message is the same (see above).</dd></dl>
<dl class="user" compact><dt><b>rx16</b></dt><dd>The <b>rx16</b> property corresponds to an incoming message from a 16-bit address XBee module with arbitrary data. The best way to use this is to turn the XBee system's autosend property on - then the Make Controller can relay rx16 messages as soon as they're received. </dd></dl>
<dl class="user" compact><dt><b></b></dt><dd>Once you've turned on autosend, if there are boards on your network that are sending IO packets, you'll receive messages like <div class="fragment"><pre class="fragment">/xbee/rx16 1234 28 0 [43 44 45 32 46 47 48] </pre></div> The first three numbers are:<ol type=1>
<li>the address of the module that sent the message (1234 in the example above)</li><li>signal strength (28 above)</li><li>the options byte (0 above), respectively. </li></ol>
</dd></dl>
<dl class="user" compact><dt><b></b></dt><dd>Following those is an OSC blob with the data (enclosed in square brackets above). These are the hex values for each byte of data.</dd></dl>
<dl class="user" compact><dt><b>rx64</b></dt><dd>The <b>rx64</b> property corresponds to an incoming message from an XBee module with samples from its IO pins. This message is just like the <b>io16</b> message, except it's coming from a board with a 64-bit address, rather than a 16-bit address. The structure of the message is the same (see above).</dd></dl>
<dl class="user" compact><dt><b>Transmit Status</b></dt><dd>The <b>tx-status</b> property gives you the status of a previously sent message. It tells you the frameID of the message that was sent and its status, which can be one of:<ul>
<li><b>Success</b>. Message was successfully transmitted and received.</li><li><b> No acknowledgement received</b>. The message was successfully sent, but not successfully received on the other end.</li><li><b> CCA Failure</b>.</li><li><b>Purged</b>. </li></ul>
</dd></dl>
<dl class="user" compact><dt><b></b></dt><dd>If you don't include a frameID for the message that you sent, a tx-status message will not be generated. An example tx-status message will look like <div class="fragment"><pre class="fragment">/xbee/tx-status 52 Success </pre></div> where 52 is the frameID and "Success" is the status.</dd></dl>
<dl class="user" compact><dt><b>Active</b></dt><dd>The <b>active</b> property corresponds to the active state of the XBee system. If you're not seeing appropriate responses to your messages to the XBee system, check whether it's active by sending the message <div class="fragment"><pre class="fragment">/xbee/active </pre></div> </dd></dl>
<dl class="user" compact><dt><b></b></dt><dd>You can set the active flag by sending <div class="fragment"><pre class="fragment">/xbee/active 1 </pre></div> </dd></dl>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Make Controller Kit</title>
<style type="text/css">
<!--
.footer {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9pt;
	color: #999999;
}
-->
</style>
</head>

<body>
<hr size="1">
<div>
  <p class="footer">The Make Controller Kit is an open source project maintained by <a href="http://www.makingthings.com">MakingThings</a>.<br />
    MakingThings code is released under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank">Apache 2.0 license</a>.<br />
    Bug tracker, development wiki and status can be found at <a href="http://dev.makingthings.com">http://dev.makingthings.com</a>.<br />
		This document was last updated on 5 Dec 2007.
</p>
</div>
<!-- Google Analytics Code -->
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-769030-1";
urchinTracker();
</script>
</body>
</html>
